﻿using UnityEngine;
using System.Collections;

public class BasePanel : MonoBehaviour {
    protected UIManager uiMng;
    public UIManager UIMng
    {
        set { uiMng = value; }
    }
    /// <summary>
    /// 界面被显示出来
    /// </summary>
    public virtual void OnEnter()
    {
        if (this.gameObject.activeSelf == false)
        {
            this.gameObject.SetActive(true);
        }
    }

    /// <summary>
    /// 界面暂停
    /// </summary>
    public virtual void OnPause()
    {

    }

    /// <summary>
    /// 界面继续
    /// </summary>
    public virtual void OnResume()
    {
        if (this.gameObject.activeSelf == false)
        {
            this.gameObject.SetActive(true);
        }
    }

    /// <summary>
    /// 界面隐藏，但并未销毁
    /// </summary>
    public virtual void OnHide()
    {
        this.gameObject.SetActive(false);
    }
    /// <summary>
    /// 界面销毁，销毁这个界面的预设
    /// </summary>
    public virtual void DestroyPanel()
    {
        Destroy(this.gameObject);
    }
}
